var isnet = function() {

	/**
	 * executes given regular expression on given text,
	 * and returns string within first matched parantheses
	 * in the regular expression
	 *
	 * @param regex regular expression to be executed.
	 * @param text source on which given regular expression
	 *        will be executed.
	 *
	 * @return Float
	 */
	var getFirstMatch = function(regex, text) {
		var matches = regex.exec(text);
		return parseFloat(matches[1].replace(/,/g, "."));
	}

	return {
		sitename: "isnet",

		url: "http://www.isnet.net.tr/channels/finans/borsasenet.aspx",

		createParams: function(stockname) {
			return {
				SenetAdi: stockname + ".IS"
			};
		},

		getName: function(responseText) {
			var regex = /^.*SenetAdi=([^.]+)\.IS.*$/m;
			var matches = regex.exec(responseText);
			return matches[1];
		},

		getLatest: function(responseText) {
			var regex = /^.*<span id="_ctl0_SenetSondegerLabel"><font size="5">([^<]+)<\/font><\/span>.*$/m;
			return getFirstMatch(regex, responseText);
		},

		getOpen: function(responseText) {
			var regex = /^.*<span id="_ctl0_lblOncekiKapanis">([^<]+)<\/span>.*$/m;
			return getFirstMatch(regex, responseText);
		},

		getChange: function(responseText) {
			var regex = /^.*<span id="_ctl0_SenetDegisimLabel">([^<]+)<\/span>.*$/m;
			return "%" + getFirstMatch(regex, responseText);
		},

		getVol: function(responseText) {
			var regex = /^.*<span id="_ctl0_SenetToplamTutarLabel">([^<]+)<\/span>.*$/m;
			return getFirstMatch(regex, responseText);
		},

		getBuy: function(responseText) {
			var regex = /^.*<span id="_ctl0_SenetAlisLabel">([^<]+)<\/span>.*$/m;
			return getFirstMatch(regex, responseText);
		},

		getSell: function(responseText) {
			var regex = /^.*<span id="_ctl0_SenetSatisLabel">([^<]+)<\/span>.*$/m;
			return getFirstMatch(regex, responseText);
		}
	}
}();
//extend sourcesite and overwrite duplicated properties
isnet = Object.extend(sourcesite, isnet);
